<!DOCTYPE html>
<!-- 
Template Name: Metronic - Responsive Admin Dashboard Template build with Twitter Bootstrap 3.0
Version: 1.5
Author: KeenThemes
Website: http://www.keenthemes.com/
Purchase: http://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469?ref=keenthemes
-->
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
   <meta charset="utf-8" />
   <title>药店进销存管理系统 | 用户列表</title>
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta content="width=device-width, initial-scale=1.0" name="viewport" />
   <meta content="" name="description" />
   <meta content="" name="author" />
   <meta name="MobileOptimized" content="320">
   <!-- BEGIN GLOBAL MANDATORY STYLES -->          
   <link href="${base}/assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
   <link href="${base}/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
   <link href="${base}/assets/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>
   <!-- END GLOBAL MANDATORY STYLES -->
   <!-- BEGIN PAGE LEVEL STYLES -->
   <link rel="stylesheet" type="text/css" href="${base}/assets/plugins/select2/select2_metro.css" />
   <link rel="stylesheet" href="${base}/assets/plugins/data-tables/DT_bootstrap.css" />
   <!-- END PAGE LEVEL STYLES -->
   <!-- BEGIN THEME STYLES --> 
   <link href="${base}/assets/css/style-metronic.css" rel="stylesheet" type="text/css"/>
   <link href="${base}/assets/css/style.css" rel="stylesheet" type="text/css"/>
   <link href="${base}/assets/css/style-responsive.css" rel="stylesheet" type="text/css"/>
   <link href="${base}/assets/css/plugins.css" rel="stylesheet" type="text/css"/>
   <link href="${base}/assets/css/themes/default.css" rel="stylesheet" type="text/css" id="style_color"/>
   <link href="${base}/assets/css/custom.css" rel="stylesheet" type="text/css"/>
   <!-- END THEME STYLES -->
   <link rel="shortcut icon" href="${base}/assets/img/favicon.ico" />
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body class="page-header-fixed">
   <#include "header.ftl">
   <!-- END HEADER -->
   <div class="clearfix"></div>
   <!-- BEGIN CONTAINER -->
   <div class="page-container">
      <!-- BEGIN SIDEBAR -->
      <div class="page-sidebar navbar-collapse collapse">
         <!-- BEGIN SIDEBAR MENU -->        
         <ul class="page-sidebar-menu">
            <li>
               <!-- BEGIN SIDEBAR TOGGLER BUTTON -->
               <div class="sidebar-toggler hidden-phone"></div>
               <!-- BEGIN SIDEBAR TOGGLER BUTTON -->
            </li>
            <li class="start">
		       <a href="${base}/admin/admin!main.action">
		       <i class="icon-home"></i> 
		       <span class="title">首页</span>
		       </a>
		    </li>
		    <li class="">
		       <a href="javascript:;">
		       <i class="icon-cogs"></i> 
		       <span class="title">业务中心</span>
		       <span class="arrow "></span>
		       </a>
		       <ul class="sub-menu">
		          <li >
		             <a href="${base}/admin/admin!cashiering.action">消费收银</a>
		          </li>
		       </ul>
		    </li>
		    <li>
		       <a href="javascript:;">
		       <i class="icon-bookmark-empty"></i> 
		       <span class="title">会员管理</span>
		       <span class="arrow "></span>
		       </a>
		       <ul class="sub-menu">
		          <li >
		             <a href="${base}/admin/member!checkin.action">会员登记</a>
		          </li>
		          <li >
		             <a href="#userInfo"  data-toggle="modal">会员信息</a>
		          </li>
		          <li >
		             <a href="${base}/admin/member!memberLevel.action">会员级别</a>
		          </li>
		          <li>
		             <a href="${base}/admin/member!memberList.action">会员列表</a>
		          </li>
		       </ul>
		    </li>
		    <li class="">
		       <a href="javascript:;">
		       <i class="icon-table"></i> 
		       <span class="title">库存管理</span>
		       <span class="arrow "></span>
		       </a>
		       <ul class="sub-menu">
		          <li >
		             <a href="${base}/admin/admin!purchase.action">采购进货</a>
		          </li>
		          <li >
		             <a href="${base}/admin/admin!refund.action">退货换货</a>
		          </li>
		          <li >
		             <a href="${base}/admin/inventory!list.action">库存盘点</a>
		          </li>
		       </ul>
		    </li>
		    <li class="">
		       <a href="javascript:;">
		       <i class="icon-sitemap"></i> 
		       <span class="title">供应商管理</span>
		       <span class="arrow "></span>
		       </a>
		       <ul class="sub-menu">
		          <li >
		             <a href="${base}/admin/supplier!add.action">供应商录入</a>
		          </li>
		          <li >
		             <a href="${base}/admin/supplier!list.action">供应商列表</a>
		          </li>
		       </ul>
		    </li>
		    <li class="">
		       <a href="javascript:;">
		       <i class="icon-gift"></i> 
		       <span class="title">药品管理</span>
		       <span class="arrow "></span>
		       </a>
		       <ul class="sub-menu">
		          <li >
		             <a href="${base}/admin/medicine!add.action">药品录入</a>
		          </li>
		          <li >
		             <a href="${base}/admin/medicine!list.action">药品列表</a>
		          </li>
		       </ul>
		    </li>
		    <li class="active">
		       <a href="javascript:;">
		       <i class="icon-user"></i> 
		       <span class="title">用户管理</span>
		       <span class="selected "></span>
		       </a>
		       <ul class="sub-menu">
		          <li >
		             <a href="${base}/admin/user!add.action">用户录入</a>
		          </li>
		          <li class = "active">
		             <a href="${base}/admin/user!list.action">用户列表</a>
		          </li>
		       </ul>
		    </li>
		    <li>
		       <a href="javascript:;">
		       <i class="icon-user"></i> 
		       <span class="title">单据管理</span>
		       <span class="arrow "></span>
		       </a>
		       <ul class="sub-menu">
		          <li>
		             <a href="${base}/admin/admin!sellerRecordList.action">消费单据</a>
		          </li>
		          <li >
		             <a href="${base}/admin/admin!purchaseList.action">采购单据</a>
		          </li>
		          <li >
		             <a href="${base}/admin/admin!refundList.action">退货单据</a>
		          </li>
		       </ul>
		    </li>
		    <!-- 会员信息弹出框开始 -->
		    <#include "memberInfoDialog.ftl">
		    <!-- 会员信息弹出框结束  -->
         </ul>
         <!-- END SIDEBAR MENU -->
      </div>
      <!-- END SIDEBAR -->
      <!-- BEGIN PAGE -->
      <div class="page-content">
      	<#include "changePassword.ftl">
         <#include "system-set.ftl">
         <!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->               
         <div class="modal fade" id="portlet-config" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
               <div class="modal-content">
                  <div class="modal-header">
                     <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                     <h4 class="modal-title">Modal title</h4>
                  </div>
                  <div class="modal-body">
                     Widget settings form goes here
                  </div>
                  <div class="modal-footer">
                     <button type="button" class="btn blue" onclick="return submitOK()">Save changes</button>
                     <button type="button" class="btn default" data-dismiss="modal">Close</button>
                  </div>
               </div>
               <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
         </div>
         <!-- /.modal -->
         <!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
         <!-- BEGIN PAGE HEADER-->
         <div class="row">
            <div class="col-md-12">
               <!-- BEGIN PAGE TITLE & BREADCRUMB-->
               <h3 class="page-title">
                  	用户列表 <small>这里列出了系统中所有的用户数据，你可以在此管理它们。</small>
               </h3>
               <ul class="page-breadcrumb breadcrumb">
                  <li>
                     <i class="icon-home"></i>
                     <a href="index.html">Home</a> 
                     <i class="icon-angle-right"></i>
                  </li>
                  <li>
                     <a href="#">用户管理</a>
                     <i class="icon-angle-right"></i>
                  </li>
                  <li><a href="#">用户列表</a></li>
               </ul>
               <!-- END PAGE TITLE & BREADCRUMB-->
            </div>
         </div>
         <!-- END PAGE HEADER-->
         <!-- BEGIN PAGE CONTENT-->
         <div class="row">
            <div class="col-md-12">
               <!-- BEGIN EXAMPLE TABLE PORTLET-->
               <div class="portlet box blue">
                  <div class="portlet-title">
                     <div class="caption"><i class="icon-globe"></i>用户列表</div>
                     <div class="tools">
                        <a href="javascript:;" class="collapse"></a>
                        <a href="javascript:;" class="remove"></a>
                     </div>
                  </div>
                  <div class="portlet-body">
                     <div class="table-toolbar">
                        <div class="btn-group">
                           <a href="${base}/admin/user!add.action" class="btn green"><i class="icon-plus"></i> 添加</a>
                          
							   <a href = "javascript:;" onclick = "return edit();" class="btn green"><i class="icon-pencil"></i> 编辑</a>
	                           <a href = "javascript:;" onclick = "return deletes();" class="btn green"><i class="icon-trash"></i> 删除</a>
	                           <a href = "javascript:;" onclick = "return start();" class="btn green"><i class="icon-ban-circle"></i> 启用</a>
	                           <a href = "javascript:;" onclick = "return stop();" class="btn green"><i class="icon-circle"></i> 停用</a>
	                           <a href = "javascript:;" onclick = "return resetPwd();" class="btn green"><i class="icon-circle"></i> 密码重置</a>
							
                        </div>
                        <div class="btn-group pull-right">
                           <button class="btn dropdown-toggle" data-toggle="dropdown">工具 <i class="icon-angle-down"></i>
                           </button>
                           <ul class="dropdown-menu pull-right">
                              <li><a href="javascript:;">打印</a></li>
                              <li><a href="javascript:;">导出为PDF</a></li>
                              <li><a href="javascript:;">导出到Excel</a></li>
                           </ul>
                        </div>
                     </div>
                     <table class="table table-striped table-bordered table-hover" id="sample_1">
                        <thead>
                           <tr>
                              <th style="width:8px;"><input type="checkbox" class="group-checkable" data-set="#sample_1 .checkboxes" /></th>
                              <th class="hidden-480">状态</th>
                              <th class="hidden-480">登录名</th>
                              <th class="hidden-480">姓名</th>
                              <th class="hidden-480">性别</th>
                              <th class="hidden-480">角色</th>
                              <th class="hidden-480">管理店面</th>
                              <th class="hidden-480">电话</th>
                              <th class="hidden-480">地址</th>
                           </tr>
                        </thead>
                        <tbody>
                        	<#if userList?exists>
	                        	<#list userList as user>
		                           <tr class="odd gradeX">
		                              <td><input type="checkbox" class="checkboxes" value="${user.id}" /></td>
		                              <td><span class="label label-sm
		                              		<#if user.status?exists>
		                              			<#if user.status="启用">label-success<#else>label-default</#if>">
		                              			${user.status}
		                              		</#if>
		                              	  </span>
		                              </td>
		                              <td class="hidden-480"><#if user.loginname?exists>${user.loginname}</#if></td>
		                              <td class="hidden-480"><#if user.fullname?exists>${user.fullname}</#if></td>
		                              <td class="hidden-480"><#if user.gender?exists>${user.gender}</#if></td>
		                              <td class="hidden-480"><#if user.role?exists>${user.role}</#if></td>
		                              <td class="hidden-480"><#if user.store?exists>${user.store}</#if></td>
		                              <td class="hidden-480"><#if user.phone?exists>${user.phone}</#if></td>
		                              <td class="hidden-480"><#if user.address?exists>${user.address}</#if></td>
		                           </tr>
	                           </#list>
                           </#if>
                        </tbody>
                     </table>
                  </div>
               </div>
               <!-- END EXAMPLE TABLE PORTLET-->
            </div>
         </div>
         <!-- END PAGE CONTENT-->
      </div>
      <!-- END PAGE -->
   </div>
   <!-- END CONTAINER -->
   <#include "footer.ftl">
   <!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
   <#include "coreJsPlugins.ftl">
   <!-- BEGIN PAGE LEVEL PLUGINS -->
   <script type="text/javascript" src="${base}/assets/plugins/select2/select2.min.js"></script>
   <script type="text/javascript" src="${base}/assets/plugins/data-tables/jquery.dataTables.js"></script>
   <script type="text/javascript" src="${base}/assets/plugins/data-tables/DT_bootstrap.js"></script>
   <!-- END PAGE LEVEL PLUGINS -->
   <!-- BEGIN PAGE LEVEL SCRIPTS -->
   <script src="${base}/assets/scripts/app.js"></script>
   <script src="${base}/assets/scripts/table-managed.js"></script>
   <script>
      jQuery(document).ready(function() {       
         App.init();
         TableManaged.init();
      });
      function deletes(){
      	var flag = "false";
      	var idValue="";
		$("#sample_1 tbody tr :checkbox").each(function(i){
			if($(this).attr("checked")=="checked"){
				flag = "true";
				idValue = $(this).attr("value")+","+idValue;
			}
		});
		if(flag=="false"){
			alert("没有选择任何数据,请选择一条数据!");
		}else{
			if(confirm("警告!是否删除当前选中的用户？") == true){
				$.ajax({
    	            type:"post",
    	            url:"/pims/admin/user!deletes.action",
    	            dataType:"json",
    	            data:"ids="+idValue,
    	            cache:false,
    	            beforeSend:function(XMLHttpRequest){
    	            },
    	            success:function(json){
    	            	success = json.success;
    	            	if(success){
    	            		window.location.href="/pims/admin/user!list.action";
    	            	}else{
    	            		alert("删除失败，请稍后重试");
    	            	}
    	            },
    	           	complete:function(XMLHttpRequest,textStatus){
    	           	},
    	          	error:function(XMLHttpRequest,textStatus,errorThrown){
    	                   alert("网络错误，请稍后重试");
    	          	}
                });
			}
		}
      	return false;
      }
      
      function edit(){
      	var flag = "false";
      	var idValue="";
		$("#sample_1 tbody tr :checkbox").each(function(i){
			if($(this).attr("checked")=="checked"){
				flag = "true";
				idValue = $(this).attr("value");
			}
		});
		if(flag=="false"){
			alert("没有选择任何数据,请选择一条数据!");
		}else{
			window.location.href="/pims/admin/user!edit.action?id="+idValue;
		}
      	return false;
      }
      
      function stop(){
      	var flag = "false";
      	var idValue="";
		$("#sample_1 tbody tr :checkbox").each(function(i){
			if($(this).attr("checked")=="checked"){
				flag = "true";
				idValue = $(this).attr("value")+","+idValue;
			}
		});
		if(flag=="false"){
			alert("没有选择任何数据,请选择一条数据!");
		}else{
			if(confirm("是否停用当前选中的用户？") == true){
				$.ajax({
    	            type:"post",
    	            url:"/pims/admin/user!updateStatusToStoping.action",
    	            dataType:"json",
    	            data:"ids="+idValue,
    	            cache:false,
    	            beforeSend:function(XMLHttpRequest){
    	            },
    	            success:function(json){
    	            	success = json.success;
    	            	if(success){
    	            		window.location.href="/pims/admin/user!list.action";
    	            	}
    	            },
    	           	complete:function(XMLHttpRequest,textStatus){
    	           	},
    	          	error:function(XMLHttpRequest,textStatus,errorThrown){
    	                   alert("网络错误，请稍后重试");
    	          	}
                });
			}
		}
      	return false;
      }
      
      function start(){
      	var flag = "false";
      	var idValue="";
		$("#sample_1 tbody tr :checkbox").each(function(i){
			if($(this).attr("checked")=="checked"){
				flag = "true";
				idValue = $(this).attr("value")+","+idValue;
			}
		});
		if(flag=="false"){
			alert("没有选择任何数据,请选择一条数据!");
		}else{
			if(confirm("是否启用当前选中的用户？") == true){
				$.ajax({
    	            type:"post",
    	            url:"/pims/admin/user!updateStatusToStart.action",
    	            dataType:"json",
    	            data:"ids="+idValue,
    	            cache:false,
    	            beforeSend:function(XMLHttpRequest){
    	            },
    	            success:function(json){
    	            	success = json.success;
    	            	if(success){
    	            		window.location.href="${base}/admin/user!list.action";
    	            	}
    	            },
    	           	complete:function(XMLHttpRequest,textStatus){
    	           	},
    	          	error:function(XMLHttpRequest,textStatus,errorThrown){
    	                   alert("网络错误，请稍后重试");
    	          	}
                });
            }    
		}
      	return false;
      }
      
      function resetPwd(){
      var flag = "false";
      	var idValue="";
		$("#sample_1 tbody tr :checkbox").each(function(i){
			if($(this).attr("checked")=="checked"){
				flag = "true";
				idValue = $(this).attr("value");
			}
		});
		if(flag=="false"){
			alert("没有选择任何数据,请选择一条数据!");
		}else{
	      	if(confirm("是否重新设置此用户的的密码为【000000】?") == true){
	      			var npwd = "000000";
					$.ajax({
	    	            type:"post",
	    	            url:"/pims/admin/user!resetPasswd.action",
	    	            dataType:"json",
	    	            data:"id="+idValue+"&npwd="+npwd,
	    	            cache:false,
	    	            beforeSend:function(XMLHttpRequest){
	    	            },
	    	            success:function(json){
	    	            	result = json.result;
			            	if(result){
			            		alert("修改成功");
			            	}else{
			            		alert("修改失败");
			            	}
	    	            },
	    	           	complete:function(XMLHttpRequest,textStatus){
	    	           	},
	    	          	error:function(XMLHttpRequest,textStatus,errorThrown){
	    	                   alert("网络错误，请稍后重试");
	    	          	}
	                });
	            }    
	       }     
      }
   </script>
</body>
<!-- END BODY -->
</html>